<template>
  <draggable
    class="draggable-plugin"
    :data="item"
    @dragstart="onSourceDragStart"
    @dragsend="onSourceDragEnd"
  >
    <div class="drag-content" :style="'background:url('+item.imgUrl+')center center no-repeat; background-size: auto 100%;'">
      <!-- <img :src="item.imgUrl" alt="" /> -->
    </div>
  </draggable>
</template>

<script>
// http://localhost:8013/static/img/heaPortrait.b075c1a3.png
import Draggable from '@/components/Drag/draggable';
export default {
  name: 'DraggableUpload',
  components: { Draggable },
  props: {
    // eslint-disable-next-line vue/require-default-prop
    item: Object
  },
  methods: {
    onSourceDragStart(params) {
      console.log('被拖动元素监听到拖动开始');
    },
    onSourceDragEnd(params) {
      console.log('被拖动元素监听到拖动结束');
    }
  }
};
</script>

<style lang="scss" scoped>
.draggable-plugin{
  .drag-content{
    width: 100%;
    height: 100%;
    text-align: center;
    img{
      height:100%;
      z-index: -1;
    }
  }
}
</style>
